<!-- templates/bootstrap5/admin/dashboard.html -->
{% extends "bootstrap5/admin/base.html" %}
{% block title %}导航网站 - 仪表盘{% endblock %}

{% block content %}
<h1 class="mb-4">仪表盘</h1>

<div class="row g-4 mb-4">
    <div class="col-md-4">
        <div class="card bg-primary text-white">
            <div class="card-body">
                <h5 class="card-title">网站数量</h5>
                <p class="card-text display-6">{{ website_count }}</p>
            </div>
        </div>
    </div>
    <div class="col-md-4">
        <div class="card bg-success text-white">
            <div class="card-body">
                <h5 class="card-title">分类数量</h5>
                <p class="card-text display-6">{{ category_count }}</p>
            </div>
        </div>
    </div>
    <div class="col-md-4">
        <div class="card bg-info text-white">
            <div class="card-body">
                <h5 class="card-title">建议数量</h5>
                <p class="card-text display-6">{{ suggestion_count }}</p>
            </div>
        </div>
    </div>
</div>

<h2 class="mb-3">最近建议</h2>
<div class="table-responsive">
    <table class="table table-striped">
        <thead>
            <tr>
                <th>ID</th>
                <th>邮箱</th>
                <th>网站</th>
                <th>描述</th>
                <th>时间</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
            {% for suggestion in recent_suggestions %}
            <tr>
                <td>{{ suggestion.id }}</td>
                <td>{{ suggestion.email if suggestion.email else '-' }}</td>
                <td>{{ suggestion.website }}</td>
                <td>{{ suggestion.description|truncate(30) }}</td>
                <td>{{ suggestion.created_at }}</td>
                <td>
                    <a href="{{ url_for('admin.handle_suggestion', id=suggestion.id) }}"
                       class="btn btn-sm btn-success">
                        处理
                    </a>
                </td>
            </tr>
            {% endfor %}
        </tbody>
    </table>
</div>
{% endblock %}